package com.ainiyar.springweb.mapper;

import com.ainiyar.springweb.pojo.entity.Menu;
import com.mybatisflex.core.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**************************************
 * File Name : MenuMapper
 * Created with : IntelliJ IDEA.
 * Author : 艾尼亚尔·毛拉吾提
 * QQ : 524155792  WeChat : ainiyar0124
 * Created Time : 2024/2/5  00:50
 * Desc :
 ***************************************/
public interface MenuMapper extends BaseMapper<Menu> {
    //根据用户ID查询权限菜单列表
    @Select("SELECT  DISTINCT t4.id FROM sw_admin AS t1" +
            " LEFT JOIN sw_role AS t2 ON  t2.id=t1.role_id" +
            " LEFT JOIN sw_role_permission AS t3 ON t3.role_id=t2.id" +
            " LEFT JOIN sw_menu AS  t4  ON t4.id=t3.permission_Id" +
            " WHERE t1.id=#{adminId} AND t4.is_delete=0 ORDER BY t4.sort ASC")
    List<Object> findPermissionListByAdminId(Long adminId);
}
